home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / nihcl-30.lha / nihcl-3.0 / test / dict.c < prev    next >
C/C++ Source or Header  |  1990-05-19  |  2KB  |  61 lines

  1. /* Test class Dictionary
  2.  
  3.     THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A
  4.     "UNITED STATES GOVERNMENT WORK".  IT WAS WRITTEN AS A PART OF THE
  5.     AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE.  THIS MEANS IT
  6.     CANNOT BE COPYRIGHTED.  THIS SOFTWARE IS FREELY AVAILABLE TO THE
  7.     PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO
  8.     RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.
  9.  
  10. Author:
  11.     K. E. Gorlen
  12.     Bg. 12A, Rm. 2033
  13.     Computer Systems Laboratory
  14.     Division of Computer Research and Technology
  15.     National Institutes of Health
  16.     Bethesda, Maryland 20892
  17.     Phone: (301) 496-1111
  18.     uucp: uunet!nih-csl!kgorlen
  19.     Internet:kgorlen@alw.nih.gov
  20.  
  21. Function:
  22.     
  23. Modification History:
  24.     
  25. $Log:    dict.c,v $
  26.  * Revision 3.0  90/05/20  00:29:00  kgorlen
  27.  * Release for 1st edition.
  28.  * 
  29. */
  30. static char rcsid[] = "$Header: /afs/alw.nih.gov/unix/sun4_40c/usr/local/src/nihcl-3.0/share/test/RCS/dict.c,v 3.0 90/05/20 00:29:00 kgorlen Rel $";
  31.  
  32. #include "Point.h"
  33. #include "Dictionary.h"
  34. #include "Assoc.h"
  35. #include "Bag.h"
  36. #include "OrderedCltn.h"
  37.  
  38. main()
  39. {
  40.     cout << "\nTest class Dictionary" << endl;
  41.     Dictionary d(16);
  42.     Assoc c(*new Point(1,3),*new Point(2,3));
  43.     d.add(*new Assoc(*new Point(1,1),*new Point(2,1)));
  44.     d.add(*new Assoc(*new Point(1,2),*new Point(2,2)));
  45.     d.add(c);
  46.     cout << "d = " << d << endl;
  47.     cout << "d.atKey(Point(1,1)): " << *(d.atKey(Point(1,1))) << endl;
  48.     d.atKey(Point(1,1),*new Point(3,1));
  49.     cout << "d = " << d << endl;
  50.     cout << "d.includesAssoc(c): " << d.includesAssoc(c) << endl;
  51.     cout << "d.includesKey(*c.key()): " << d.includesKey(*c.key()) << endl;
  52.     cout << "d.keyAtValue(Point(3,1)) = " << *d.keyAtValue(Point(3,1)) << endl;
  53.     d.removeKey(*c.key());
  54.     cout << "d.includesAssoc(c): " << d.includesAssoc(c) << endl;
  55.     cout << "d.includesKey(*c.key()): " << d.includesKey(*c.key()) << endl;
  56.     cout << "d.asBag: " << d.asBag() << endl;
  57.     OrderedCltn keys,vals;
  58.     cout << "d.addKeysTo(keys): " << d.addKeysTo(keys) << endl;
  59.     cout << "d.addValuesTo(vals): " << d.addValuesTo(vals) << endl;
  60. }
  61.